Hệ thống quản lý ISP trong PHP

1 <?php
2     require_once
"includes/headx.php";
3     
if (!isset($_SESSION['admin_session']) )
4     {
5         $commons->redirectTo(SITE_PATH.
'login.php');
6     }
7     require_once
"includes/classes/admin-class.php";
8     $admins =
new Admins($dbh);
9     ?>
10 <!doctype html>
11 <html lang=
"en" class="no-js">
12 <head>
13     <meta charset=
" utf-8">
14     <meta name=
"viewport" content="width=device-width, initial-scale=1">
15     <link href=
'https://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
16     <link rel=
"stylesheet" href="component/css/bootstrap.css"> <!-- CSS bootstrap -->
17     <link rel=
"stylesheet" href="component/css/style.css"> <!-- Resource style -->
18     <link rel=
"stylesheet" href="component/css/reset.css"> <!-- Resource style -->
19     <link rel=
"stylesheet" href="component/css/invoice.css"> <!-- CSS bootstrap -->
20     <script src=
"component/js/modernizr.js"></script> <!-- Modernizr -->
21     <title>Categories | Netway</title>
22 </head>
23 <body>
24 <div
class="container">
25     <div
class="row">
26         <br>
27         <button
class="btn btn-success" data-toggle="modal" data-target="#add_category">Add new Packages</button>
28         <button
class="btn btn-danger pull-right" onclick="window.opener.location.reload();window.close();">Close</button>
29     </div>
30     <div
class="row">
31         <table
class="table table-striped table-bordered">
32             <thead
class="thead-inverse">
33                 <tr>
34                     <th>SL </th>
35                     <th>Name</th>
36                     <th>Action</th>
37                 </tr>
38             </thead>
39             <tbody>
40
41             </tbody>
42         </table>
43     </div>
44     <div
class="message">Do not remove categories.</div>
45 </div>
46     <!-- New modal -->
47     <div
class="modal fade" id="add_category">
48         <div
class="modal-dialog" role="document">
49           <div
class="modal-content">
50                 <div
class="modal-header">
51                     <button type=
"button" class="close" data-dismiss="modal">×</button>
52                     <h4>Category details</h4>
53                 </div>
54                 <form id=
"insert_form" method="POST">
55                     <div
class="modal-body">
56                         <fieldset>
57                             <div
class="form-group has-success">
58                                 <label
for="name">Name</label>
59                                 <input type=
"text" class="form-control" id="name" name="name" placeholder="Enter Name" required>
60                             </div>
61                         </fieldset>
62                     </div>
63                     <div
class="modal-footer">
64                         <button type=
"submit" class="btn btn-primary">Submit</button>
65                         <a href=
"#" class="btn btn-warning" data-dismiss="modal">Cancel</a>
66                     </div>
67                 </form>
68           </div>
69         </div>
70     </div>
71 </body>
72 <?php include
'includes/footer.php'; ?>
73 <script type=
"text/javascript">
74
75         $(
'#insert_form').on('submit',function(event){
76             
event.preventDefault();
77             $.ajax({
78                 url:
"categories_approve.php?p=add",
79                 method:
"POST",
80                 data:$(
'#insert_form').serialize(),
81                 success: function (data) {
82                     $(
'#insert_form')[0].reset();
83                     $(
'#add_category').modal('hide');
84                         viewData();
85                 }
86             });
87         });
88         function viewData() {
89             $.ajax({
90                 method:
"GET",
91                 url:
"categories_approve.php",
92                 success: function(data){
93                     $(
'tbody').html(data);
94                 }
95             });
96         }
97         function delData(del_id){
98             
var id = del_id;
99             $.ajax({
100                 method:
"POST",
101                 url:
"categories_approve.php?p=del",
102                 data:
"id="+id,
103                 success: function (data){
104                     viewData();
105                 }
106             });
107         }
108         function upData(str){
109             
var name = $('#nm-'+str).val();
110             
var id = str;
111             $.ajax({
112                 method:
"POST",
113                 url:
"categories_approve.php?p=edit",
114                 data:
"name="+name+"&id="+id,
115                 success: function (data){
116                     $(
'#edit-'+str).modal('hide');
117                     viewData();
118                 }
119             });
120         }
121         window.onload=viewData();
122     </script>


Gõ tìm kiếm nhanh...